package com.projectName.www.servlet;


import com.projectName.www.service.*;
import com.projectName.www.po.User;

import javax.swing.*;
import javax.swing.GroupLayout.Alignment;
import javax.swing.border.EmptyBorder;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * @author 86132
 *
 */
public class S_J extends JFrame {

    private JPanel contentPane;


    public void getUser(User user)
    {

    }



    /**
     * Launch the application.
     */
    public static void main(String[] args) {
        User user=new User();
        EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {

                    S_J frame = new S_J();

                    frame.setVisible(true);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        });
    }

    public S_J() {


        setDefaultCloseOperation(3);
        setBounds(100, 100, 800, 700);
        contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));

        setContentPane(contentPane);

        JDesktopPane desktopPane = new JDesktopPane();
        GroupLayout gl_contentPane = new GroupLayout(contentPane);
        gl_contentPane.setHorizontalGroup(
                gl_contentPane.createParallelGroup(Alignment.LEADING)
                        .addGroup(gl_contentPane.createSequentialGroup()
                                .addComponent(desktopPane, GroupLayout.PREFERRED_SIZE, 800, GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        gl_contentPane.setVerticalGroup(
                gl_contentPane.createParallelGroup(Alignment.LEADING)
                        .addGroup(gl_contentPane.createSequentialGroup()
                                .addComponent(desktopPane, GroupLayout.PREFERRED_SIZE, 700, GroupLayout.PREFERRED_SIZE)
                                .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        JButton insertshop = new JButton("创建店铺");
        insertshop.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                S_J_insertshop is=new S_J_insertshop();
                is.setVisible(true);

                desktopPane.add(is);
            }
        });
        insertshop.setBounds(25, 74, 158, 70);
        desktopPane.add(insertshop);

        JButton insertCoupons = new JButton("发放优惠券");
        insertCoupons.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                S_J_insertcoupons sj= null;
                try {
                    sj = new S_J_insertcoupons();
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }
                sj.setVisible(true);
                desktopPane.add(sj);
            }
        });
        insertCoupons.setBounds(25, 201, 158, 70);
        desktopPane.add(insertCoupons);

        JButton updateshop = new JButton("修改菜单");
        updateshop.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {

                S_J_updatadishes sj = null;
                try {
                    sj = new S_J_updatadishes();
                } catch (Exception ex) {
                    throw new RuntimeException(ex);
                }

                sj.setVisible(true);
                desktopPane.add(sj);
            }
        });
        updateshop.setBounds(476, 74, 158, 70);
        desktopPane.add(updateshop);

        JButton selectorder = new JButton("查看订单");
        //selectorder.setBackground(Color.RED);
        selectorder.addActionListener(e->
        {
            S_J_orders sj= null;
            try {
                sj = new S_J_orders();
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
            sj.setVisible(true);
            desktopPane.add(sj);
        });
        selectorder.setBounds(476, 201, 158, 70);
        desktopPane.add(selectorder);

        JButton selectmessage = new JButton("查看留言");
        selectmessage.addActionListener(e -> {
            S_J_selectmessage is= null;
            try {
                is = new S_J_selectmessage();
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
            is.setVisible(true);

            desktopPane.add(is);
        });
        selectmessage.setBounds(25, 338, 158, 70);
        desktopPane.add(selectmessage);
        JButton insert = new JButton("增加菜品");
        insert.setBounds(476, 338, 158, 70);
        desktopPane.add(insert);
        insert.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                S_J_insertdishes is=new S_J_insertdishes();
                is.setVisible(true);


                desktopPane.add(is);
            }
        });
        contentPane.setLayout(gl_contentPane);

        contentPane.add(desktopPane, BorderLayout.CENTER);
        //this.setExtendedState(JFrame.MAXIMIZED_BOTH);//最大化
        this.setLocationRelativeTo(null);//居中


    }

}

